<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>大棚数据大屏</title>
    <link rel="stylesheet" type="text/css" href="css/zui.css" media="all">
    <link rel="stylesheet" type="text/css" href="css/login.css" media="all">
    <link href="css/animate.min.css" rel="stylesheet">
    <link href="css/font-awesome.min.css" rel="stylesheet">
    <link rel="stylesheet" href="layui2.2.6/css/layui.css" media="all"/>
    <style>
        body {
            background-image: url(login/img/loginbg1.jpg);
        }
    </style>
</head>
<body>
<div id="main-box"></div>
<div id="main-content">
    <div class="login-body  animated fadeInLeft">
        <div class="login-main pr">
            <form action="javascript:;" method="post" class="login-form">
                <h3>大棚数据大屏</h3>
                <!-- 账号登陆 -->
                <div id="MobileBox" class="item-box">
                    <div class="input-group user-name">
                        <span class="input-group-addon"><i class="icon-user"></i></span>
                        <input type="text" name="adminName" id="adminName"
                               class="form-control" placeholder="用户名">
                    </div>
                    <div class="input-group password">
                        <span class="input-group-addon"><i class="icon-lock"></i></span>
                        <input type="password" name="adminPassword" id="adminPassword"
                               class="form-control" placeholder="密码">
                    </div>

                    <!-- <div class="use-qrcode-a"><a class="use-ding" href="javascript:void(0)"><img src="images/ding.png" width="17" height="17" style="margin-top:-2px"> 钉钉账号登陆</a> </div> -->


                    <div class="login_btn_panel">
                        <button class=" btn btn-primary btn-block btn-lg"
                                data-ajax="post" type="submit" id="submit"
                                data-callback="success">登录
                        </button>
                        <br />
                        <div class="check-tips"></div>
                    </div>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="layui2.2.6/layui.all.js"></script>
<script type="text/javascript">
    $(function () {

        $("#submit")
            .click(
                function () {
                    var index = layer.load(2);
                    var data = {
                        "name": $("#adminName").val(),
                        "password": $("#adminPassword").val()
                    }


                    $.ajax({
                        traditional: true,
                        url: "../user/login",
                        data: {
                            name: $("#adminName").val(),
                            pwd: $("#adminPassword").val()
                        },
                        dataType: "text",
                        type: "get",
                        success: function (data) {
                            layer.close(index);
                            if (data != "notExist") {
                                layer.msg('登录成功，欢迎回来尊敬的管理员!', {
                                    icon: 6
                                }, function () {
                                    window.location.href = "index.html?token="+data;
                                });
                            } else {
                                layer.msg('账号或密码输入错误!', {
                                    icon: 5
                                });
                            }
                        }
                    });
                })
    });
</script>

</body>
</html>
